package com.alipay.api;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;

import com.alipay.config.AlipayConfig;
import com.alipay.model.RefundFastpayByPlatformNopwdReq;
import com.alipay.util.AlipaySubmit;

/**
 * 支付宝即时到账批量退款无密接口
 *
 */
public class RefundFastpayByPlatformNopwdApi {
	
//	private Logger logger = LoggerFactory.getLogger(getClass());

	public void execute(RefundFastpayByPlatformNopwdReq req, HttpServletRequest request, HttpServletResponse response) throws Exception {
		//把请求参数打包成数组
		Map<String, String> sParaTemp = new HashMap<String, String>();
		sParaTemp.put("service", AlipayConfig.refund_fastpay_by_platform_nopwd_service);
		sParaTemp.put("partner", AlipayConfig.partner);
		sParaTemp.put("_input_charset", AlipayConfig.input_charset);
		sParaTemp.put("notify_url", AlipayConfig.refund_notify_url);
		sParaTemp.put("batch_no", req.getBatch_no());
		sParaTemp.put("refund_date", req.getRefund_date());
		sParaTemp.put("batch_num", req.getBatch_num());
		sParaTemp.put("detail_data", req.getDetail_data());
		
		//建立请求
		String sHtmlText = AlipaySubmit.buildRequest("", "", sParaTemp);
		response.setContentType("text/html");
		response.getWriter().print(sHtmlText);
	}

}
